package com.greenantmall.view;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;

import com.greenantmall.R;

public class QuJianDialog extends Dialog {
	private Context mContext;
	private Button mBtnSure;
	private Button mBtnCancel;
	private BtnClickListener mBtnClickListener;
	
	public interface BtnClickListener {
		public void btnSureClick();
		public void btnCancelClick();
	}
	
	private android.view.View.OnClickListener mOnClickListener = new android.view.View.OnClickListener() {
		@Override
		public void onClick(View v) {
			if(v.equals(mBtnSure)) {
				if(mBtnClickListener != null) {
					mBtnClickListener.btnSureClick();
				}
				mBtnSure.setEnabled(false);
			}
			else if(v.equals(mBtnCancel)) {
				dismiss();
				if(mBtnClickListener != null) {
					mBtnClickListener.btnCancelClick();
				}
			}
		}
	};
	
	public QuJianDialog(Context context, BtnClickListener listener) {
		super(context, R.style.choose_date_dialog_style);
		setContentView(R.layout.qujian_dialog);
		mContext = context;
		this.mBtnClickListener = listener;
		this.setCanceledOnTouchOutside(false);
		this.setCancelable(false);
		
		mBtnSure = (Button)findViewById(R.id.choose_date_dialog_bottom_btn_sure);
		mBtnCancel = (Button)findViewById(R.id.choose_date_dialog_bottom_btn_cancel);
		
		mBtnSure.setOnClickListener(mOnClickListener);
		mBtnCancel.setOnClickListener(mOnClickListener);
	}
}















